---
name: "pg_autoctl perform switchover"
section: "1"
platform: "linux"
package: "pg-auto-failover-cli"
version: "2.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_autoctl perform switchover"
---

# pg\_autoctl perform switchover(1)

pg\_autoctl perform switchover pg\_autoctl perform switchover - Perform a switchover for given formation and group

## NAME

pg\_autoctl perform switchover - pg\_autoctl perform switchover

pg\_autoctl perform switchover - Perform a switchover for given formation and group

## SYNOPSIS

This command starts a Postgres switchover orchestration from the pg\_auto\_switchover monitor:

```
usage: pg_autoctl perform switchover  [ --pgdata --formation --group ]
--pgdata      path to data directory
--formation   formation to target, defaults to 'default'
--group       group to target, defaults to 0
```

## DESCRIPTION

The pg\_auto\_switchover monitor can be used to orchestrate a manual switchover, sometimes also known as a switchover. When doing so, split-brain are prevented thanks to intermediary states being used in the Finite State Machine.

The **pg\_autoctl perform switchover** command waits until the switchover is known complete on the monitor, or until the hard-coded 60s timeout has passed.

The switchover orchestration is done in the background by the monitor, so even if the **pg\_autoctl perform switchover** stops on the timeout, the switchover orchestration continues at the monitor.

See also *pg\_autoctl perform failover*, a synonym for this command.

## OPTIONS

- **--pgdata**

  Location of the Postgres node being managed locally. Defaults to the environment variable **PGDATA**. Use **--monitor** to connect to a monitor from anywhere, rather than the monitor URI used by a local Postgres node managed with **pg\_autoctl**.

- **--formation**

  Formation to target for the operation. Defaults to **default**.

- **--group**

  Postgres group to target for the operation. Defaults to **0**, only Citus formations may have more than one group.

## ENVIRONMENT

PGDATA

Postgres directory location. Can be used instead of the **--pgdata** option.

PG\_AUTOCTL\_MONITOR

Postgres URI to connect to the monitor node, can be used instead of the **--monitor** option.

PG\_CONFIG

Can be set to the absolute path to the *pg\_config* Postgres tool. This is mostly used in the context of building extensions, though it can be a useful way to select a Postgres version when several are installed on the same system.

PATH

Used the usual way mostly. Some entries that are searched in the PATH by the **pg\_autoctl** command are expected to be found only once, to avoid mistakes with Postgres major versions.

PGHOST, PGPORT, PGDATABASE, PGUSER, PGCONNECT\_TIMEOUT, ...

See the *Postgres docs about Environment Variables* for details.

TMPDIR

The pgcopydb command creates all its work files and directories in **${TMPDIR}/pgcopydb**, and defaults to **/tmp/pgcopydb**.

XDG\_CONFIG\_HOME

The pg\_autoctl command stores its configuration files in the standard place XDG\_CONFIG\_HOME. See the *XDG Base Directory Specification*.

XDG\_DATA\_HOME

The pg\_autoctl command stores its internal states files in the standard place XDG\_DATA\_HOME, which defaults to **~/.local/share**. See the *XDG* *Base Directory Specification*.

## AUTHOR

Microsoft

## COPYRIGHT

Copyright (c) Microsoft Corporation. All rights reserved.
